<template>
  <div class="taolun-finish">
    <el-breadcrumb separator=">">
      <el-breadcrumb-item :to="{ path: '/' }">系统首页</el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/selection' }">干部选任</el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/selection/taolun' }">讨论决定</el-breadcrumb-item>
    </el-breadcrumb>
    <section class="wboxnoborder">
      <div :style="'height:'+tableHeight+'px'">
        <el-scrollbar style="height: calc(100% + 16px); margin: 15px;">
          <div class="tit">领导批示信息</div>
          <div class="item">
            <div class="item-left">时间:</div>
            <div class="item-right">{{fdata.reportDate}}</div>
          </div>
          <div class="item">
            <div class="item-left">附件:</div>
            <div class="item-right">
              <el-link
                v-for="item of fdata.reportBatchFiles"
                :key="item.id"
                type="primary"
                :href="$http.defaults.baseURL+$http.defaults.selectionAPI+'api/gen/file/download?id='+item.id"
                style="margin-left: 8px;">{{item.fileName}}.{{item.fileType}}</el-link>
            </div>
          </div>
          <div class="item">
            <div class="item-left">部长批示</div>
            <div class="item-right">{{fdata.leaderOpinion}}</div>
          </div>
          <div class="item">
            <div class="item-left">分管部领导批示</div>
            <div class="item-right">{{fdata.leaderOpinion2}}</div>
          </div>
          <div class="item">
            <div class="item-left">司长批示</div>
            <div class="item-right">{{fdata.leaderOpinion3}}</div>
          </div>
          <div class="line"></div>
          <div class="tit">会议审议信息</div>
          <div class="item">
            <div class="item-left">次序</div>
            <div class="item-right">第{{fdata.meetingTimes}}次</div>
          </div>
          <div class="item">
            <div class="item-left">会议类型</div>
            <div class="item-right">{{msgArr[fdata.meetingType]}}</div>
          </div>
          <div class="item">
            <div class="item-left">会议时间</div>
            <div class="item-right">{{fdata.meetingDate}}</div>
          </div>
          <div class="item">
            <div class="item-left">会议纪要</div>
            <div class="item-right">{{fdata.decisionContent}}</div>
          </div>
          <div class="item">
            <div class="item-left">报部附件</div>
            <div class="item-right">
              <el-link
                v-for="item of fdata.decisionMeetingFiles"
                :key="item.id"
                type="primary"
                :href="$http.defaults.baseURL+$http.defaults.selectionAPI+'api/gen/file/download?id='+item.id"
                style="margin-left: 8px;">{{item.fileName}}.{{item.fileType}}</el-link>
            </div>
          </div>
          <div class="line"></div>
          <notice :noticePersonId="personId" :step="6"></notice>
        </el-scrollbar>
      </div>
    </section>
  </div>
</template>

<script>
import notice from '../common/Notice'
export default {
  name: 'taolun-finish',
  data () {
    return {
      tableHeight: 100,
      personId: '',
      msgArr: ['无', '党组会', '司办会'],
      fdata: {}
    }
  },
  components: {
    notice
  },
  mounted () {
    // 获取完成data
    let pid = this.$route.params.id
    console.log('人选pid:', pid)
    this.personId = pid
    this.showFinishData(pid)
    // resize
    this.tableresize(this)
    let _this = this
    window.onresize = function windowResize () {
      // 通过捕获系统的onresize事件触发我们需要执行的事件
      _this.tableresize(_this)
    }
  },
  methods: {
    showFinishData (pid) {
      let that = this
      const loading = that.$loading({
        lock: true,
        text: '加载中...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      })
      let url = that.$http.defaults.selectionAPI + 'api/selection/decision/getPersonDecisionStepInfo'
      console.log(url)
      that.$http.get(url, {
        params: {
          personId: pid
        }
      }).then(res => {
        console.log('get finish data succ:', res)
        if (res.data.success === true) {
          loading.close()
          let rs = res.data.result
          that.fdata = rs
        } else {
          loading.close()
          that.$message({
            message: '数据获取失败',
            type: 'error'
          })
        }
      })
    },
    tableresize (obj) {
      var clientHeight = 0
      if (document.body.clientHeight && document.documentElement.clientHeight) {
        clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight
      } else {
        clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight
      }
      obj.$nextTick(function () {
        obj.tableHeight = clientHeight - 165
      })
    }
  }
}
</script>

<style>
.taolun-finish .wboxnoborder .el-table{
  border: #95B8E7 solid 1px;
}
.taolun-finish .wboxnoborder .el-table th{
  font-weight: normal;
  background-image: linear-gradient(to bottom , #f8f8f8, #efefef);
  text-align: center;
  border-right: #95B8E7 solid 1px;
  border-bottom: #95B8E7 solid 1px;
  min-height: 30px;
  line-height:30px;
}
.taolun-finish .wboxnoborder .el-table td, .el-table th{
  padding:0;
  font-size:var(--size14) !important;
  line-height: 20px;
  font-family: '宋体';
  text-align: center;
}
.taolun-finish .el-table__row{
  height: 50px;
}
</style>
<style scoped>
.taolun-finish {
  width: 100%;
}
.tit {
  width: 100%;
  height: 40px;
  line-height: 40px;
  font-size: 16px;
}
.item {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
}
.item-left {
  width: 120px;
  text-align: right;
}
.item-right {
  width: 60%;
  margin-left: 15px;
  color: #409eff;
}
.line {
  width: 100%;
  height: 2px;
  background-color: #409EFF;
  margin-top: 20px;
}
.taolun-finish .wboxnoborder {
  padding: 0;
  width: 100%;
  background-color: #fff;
  margin: 0 10px;
  overflow: hidden;
}
</style>
